import request from '@/utils/request'
export const getRoles = params => {
  return request({
    url: '/sys/role',
    params
  })
}
// 删除角色
export const delRoles = id => {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}
// 新增角色
export const addRoles = data => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}
// 分配权限

export const allRole = data => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
// 获取角色详情
export const getroleDetail = id => {
  return request({
    url: `/sys/role/${id}`
  })
}
// 给角色分配权限
export const assignpermission = data => {
  return request({
    url: `/sys/role/assignPrem`,
    method: 'PUT',
    data
  })
}

// 修改角色
export const editRole = data => {
  return request({
    method: 'PUT',
    url: `/sys/role/${data.id}`,
    data
  })
}
